# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Denis Martinez <deuns.martinez@gmail.com>

pkgname=wt
pkgver=4.9.2
pkgrel=1
pkgdesc="a C++ library and application server for developing and deploying web applications"
arch=('loong64' 'x86_64')
url="http://www.webtoolkit.eu/"
license=('GPL')
depends=('boost-libs' 'libharu' 'graphicsmagick' 'pango' 'zlib' 'libgl' 'harfbuzz'
         'qt5-base')
makedepends=('boost' 'cmake' 'postgresql-libs' 'fcgi' 'sqlite' 'mysql++' 'doxygen'
             'graphviz' 'mesa' 'glu' 'ninja')
optdepends=('openssl: for SSL support in built-in webserver'
	    'fcgi: for FastCGI support'
	    'postgresql-libs: for PostgreSQL Dbo support'
        'mariadb-libs: for MySQL Dbo support'
	    'sqlite: for Sqlite Dbo support'
	    'mysql++: for the hangman example')
backup=('etc/wt/wt_config.xml')
source=("$pkgname-$pkgver.tar.gz::https://github.com/kdeforche/wt/archive/${pkgver}.tar.gz")
sha512sums=('2b6d952d4fd2071fcfd4c8e22b9ef6c14ffaa5c8b8d7d46731eaaba2d8e002dd5ed25bb3ce05a25f20fed3d32c406b1cd16b0ccd111e3c6f9eca85e8a8350f51')

build() {
  cd ${pkgname}-${pkgver}

  cmake \
      -Bbuild \
      -GNinja \
      -DCONNECTOR_HTTP=ON \
      -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DWEBUSER=http \
      -DWEBGROUP=http \
      -DUSE_SYSTEM_SQLITE3=ON \
      -DINSTALL_EXAMPLES=ON \
      -DBUILD_EXAMPLES=ON
  ninja -C build
}

package() {
  cd "$srcdir"/${pkgname}-${pkgver}

  DESTDIR="$pkgdir" ninja -C build install
}
